MediaDetail = Ext.extend(Ext.Panel, {
    initComponent: function() {
        this.id = 'MediaInfo';
        this.title = 'Информация по рекламному направлению';
        this.region = 'center';
        this.layout = 'border';
        this.margins = '0 0 0 0';
        this.cmargins = '0 0 0 0';
        this.border = false;
        this.autoScroll = true;
        
        this.initComonInfoPanel();
        this.initFinInfoPanel();

        this.items =  [ this.ComonInfoPanel, this.FinInfoPanel ];

        MediaDetail.superclass.initComponent.call(this);
        
        //this.ComonInfoTpl.overwrite(Ext.getCmp('ComonInfoPanel').body, { shem: '', actors: '', contracts:'' });

    },
    initComonInfoPanel: function() {
        this.ComonInfoTpl = new Ext.Template([
            '<div class="detail_header">Детали</div>',
            '<div class="detail_label" style="width:140px">Схема реализации:</div><div class="detail_data" style="width:auto">{shem_type_name}</div><br style="clear:both"/>',
            '<div class="detail_label" style="width:140px">Участники:</div><div class="detail_data" style="width:auto">{actors}</div><br style="clear:both"/>',
            '<div class="detail_label" style="width:60px">Контракты:</div><br style="clear:both"/><div class="detail_data" style="width:auto; padding: 0 10px;">{contract1_name}<br>{contract2_name}<br>{contract3_name}</div>'
        ]);
        this.ComonInfoPanel = new Ext.Panel({
            id: 'ComonInfoPanel',
            //layout: 'border',
            margins: '3 3 0 3',
            cmargins: '3 3 0 3',
            region: 'north',
            height: 200,
            html: '---'
            //items:[{}]
        });
    },
    initFinInfoPanel: function() {
        this.FinInfoPanel = new Ext.Panel({
            //layout: 'border',
            region: 'center',
            margins: '3 3 3 3',
            cmargins: '3 3 3 3',
            html: '---'
            //items:[{}]
        });
    },
    getComonInfo: function(data) {
        Ext.Ajax.request({
            url: 'main?action=GetComonMediaInfo',
            params: { media_id: data.object_id },
            scope: this,
            callback: function(options, success, response) {
                var ansv = Ext.decode(response.responseText);
                if(ansv.success === true) {
                    this.ComonInfoTpl.overwrite(Ext.getCmp('ComonInfoPanel').body, ansv.data );
                } else { error_mes('Ошибка',  ansv.error); }
            }
        });
    }
});


